<?php
namespace app\admin\model;
use think\Db;
use think\Model;

class BankModel extends Model
{
	 public function __construct()
    {
        parent::__construct();

    }
    public function getDriverBankList($map=array(),$flag = true,$page=1,$limit=10)
    {
    	return $flag ? Db::name('driver_bank a')->join('__BANK__ b','a.bank_id = b.id','LEFT')
            ->join('xm_driver_base c','a.driver_id = c.driver_id','LEFT')->page($page,$limit)->where($map)
            ->order('a.id desc')->field('a.*,b.bank_name,b.bank_pic,c.driver_name')->select():
            Db::name('driver_bank a')->join('__BANK__ b','a.bank_id = b.id','LEFT')
                ->join('xm_driver_base c','a.driver_id = c.driver_id','LEFT')->where($map)
                ->order('a.id desc')->field('a.*,b.bank_name,b.bank_pic,c.driver_name')->find();
    }

    public function getBank($map,$field='*',$flag=true,$page=1,$limit=10)
    {
        return $flag ? Db::table('xm_bank')->where($map)->field($field)->page($page,$limit)->select()
            : Db::table('xm_bank')->where($map)->field($field)->find();
    }
}
